<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8"/>
  <title>通过$el获取元素</title>
  <style>
    [v-cloak] {
      display: none;
    }
  </style>
</head>
<body>

  <div id="app" v-cloak>
    <span>Hello,world!</span>
    <h1>标题</h1>
  </div>
  
  <script src="../lib/vue.3.4.js"></script>
  <script>
    const app = Vue.createApp({
      mounted () {
        console.log(this.$el);
        console.log(this.$el.parentElement);
      }
    }).mount('#app');
  </script>
</body> 
</html>